<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.kingbi.util.ConstantFiles.UserConstant"%>
<%@page import="java.util.List"%>
<%@page import="com.kingbi.system.function.model.FunctionModel"%>
<%@page import="com.kingbi.util.ConstantFiles.SysMagContant"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>

<%
    String path = request.getContextPath();
    String userName = (String)session.getAttribute(UserConstant.USER_MAP_KEY_NAME);
    List funList = (List) session
            .getAttribute(UserConstant.USER_MAP_LEFT_FUN_LIST_KEY_NAME);
    String fristMainPage = (String)session.getAttribute(UserConstant.USER_MAP_MAIN_FRIST_PAGE_KEY_NAME);
    fristMainPage =  path+fristMainPage;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link type="text/css" rel="stylesheet" href="<%=path%>/css/reset.css" />
		<link type="text/css" rel="stylesheet" href="<%=path%>/css/sideL.css" />
		<script type="text/javascript" src="<%=path%>/js/function.js"
			charset="utf-8"></script>
		<title>头页面</title>
	</head>

	<body onLoad="select('<%=fristMainPage%>')">
		<f:view>
			<h:form id="leftMenuForm">
				<h:inputHidden id="userID" value="#{loginBean.userID}"></h:inputHidden>
				<div class="sideL">
					<h2 class="title tit1">
						用户信息
					</h2>
					<div class="clumn1">	
					<p>                                                        
                         <script type="text/javascript">
                            function PageDate()
                            {
                                var currentDate = new Date()
                                with (currentDate)
                                {
                                    day=getDay()
                                    month=getMonth()+1
                                    this.document.write(getFullYear()+'年'+month+'月'+getDate()+'日')
                                }
                                if (day==1){document.write(' 星期一')}
                                if (day==2){document.write(' 星期二')}
                                if (day==3){document.write(' 星期三')}
                                if (day==4){document.write(' 星期四')}
                                if (day==5){document.write(' 星期五')}
                                if (day==6){document.write(' 星期六')}
                                if (day==0){document.write(' 星期日')}
                                document.write('<br>')
                            }
                            PageDate();
                        </script>
                        </p>            
							
						<p>
							用 户 名：
							<a href="#" class="red"><%=userName%>, 你好!</a>
						</p>
						
						<p>							
							<a href="#" class="red">修改用户信息</a> |
							<a href="#">修改密码</a>
						</p>
					</div>
					<div class="clumn2">
						<ul id="ulList">						
<%
	if(funList != null && funList.size() > 0)
	{
		for (int i = 0; i < funList.size(); i++)
		{
			FunctionModel funModel = new FunctionModel();
			funModel = (FunctionModel) funList.get(i);
			//没有子菜单的二级菜单
			if(funModel.getHasChild()!=null && funModel.getHasChild().equals("0")
					&& funModel.getFuncLevel() != null 
					&& funModel.getFuncLevel().equals(SysMagContant.FUNCTION_LEVEL_TWO))
			{
			   //System.out.println("*****************没有子菜单的二级菜单");
%>
				<li>
                     <span> <%=funModel.getName()%></span>
                     <ul>
                         <li onclick="show(this);">
                              <a href="<%=path%><%=funModel.getPageUrl()%>&funRight=<%=funModel.getFunRight()%>" target="mainFrame">
                                 <div class="zi_1">
                                   <%=funModel.getName()%>
                                 </div> 
                             </a>
                         </li>
                     </ul>
                </li>
<%
			}
			//有子菜单的二级菜单
			else if(funModel.getHasChild() != null && funModel.getHasChild().equals("1")
						&& funModel.getFuncLevel() != null
						&& funModel.getFuncLevel().equals(SysMagContant.FUNCTION_LEVEL_TWO))
				 {
				       //  System.out.println("*****************有子菜单的二级菜单");
%>
                    <li>
						<span><%=funModel.getName()%></span>
						  <ul>
<%
				 }
				 //三级菜单
				 else if(funModel.getFuncLevel() != null
                        && funModel.getFuncLevel().equals(SysMagContant.FUNCTION_LEVEL_THREE))
                       {
                          //  System.out.println("*****************三级菜单");
%>
				                <li onclick="show(this);">
				                    <a href="<%=path%><%=funModel.getPageUrl()%>&funRight=<%=funModel.getFunRight()%>" target="mainFrame" >
					                   <div class="zi_1">
					                      <%=funModel.getName()%>
					                    </div> 
				                     </a>
				                </li>
<%                     }
                        //本二级菜单下的三级菜单结束
                       else if(funModel.getThisTwoMenuEnd()!= null
                        && funModel.getThisTwoMenuEnd().equals("end"))
                        {
                            //System.out.println("*****************本二级菜单下的三级菜单结束");
%>
                           </ul>
                     </li>
<%
                        }                        
		}
	}
%>
							
						
		</ul>
		</div>
				<div class="sideL_bottom"></div>
		</div>
			</h:form>
		</f:view>
	</body>
</html>
<script type="text/javascript">

	HoverLi("ulList","span",0);
	
	function select(pageUrl) 
	{
	    window.parent.document.all.mainFrame.contentWindow.location=pageUrl;
	}
</script>